<%-- 
    Document   : cv
    Created on : Mar 26, 2013, 3:37:40 PM
    Author     : KJWT
--%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@page import="java.util.*"%>
<%@page import="entities.Product"%>
<%@page import="entities.Account"%>
<%@page import="servlets.ServletChargementDonnees"%>
<%@page import="servlets.tools.EtatProduct_Translator"%>
<%@page import="entities.Photo"%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<!-- Affichage de la fiche d'un prestataire, de son CV, et des commentaires sur ce prestataire. -->

<%
    String p_first_path = new String("images/stock_images/900x500_2.jpg");
    List<Photo> listephotos = new ArrayList<Photo>();
    Product oth_p_tmp = new Product();
    String p_etat_full = new String("");
    EtatProduct_Translator eP_Tra = new EtatProduct_Translator();

    Product presta = (Product) request.getSession().getAttribute("p_presta");
    int presta_vide = 1;
    int presta_id = 0;

    if (presta != null) {
        presta_vide = 0;
        presta_id = presta.getIdProduct();
        p_etat_full = eP_Tra.etat_translate(presta.getEtat());
        if (p_etat_full != null) {
            request.getSession().setAttribute("p_etat_full", p_etat_full);
        }
    }
%>


<html>
    <head>
        <title>Adopte Un Presta - Fiche de <%= presta.getPrenom()%> <%= presta.getNom()%></title>
        <meta charset="utf-8">
        <meta name="description" content="Site de vente de prestataires">
        <meta name="keywords" content="Prestataire, SSII, recrutement, RH, vente">
        <meta name="author" content="Kheira, Jef, William, Tuan">
        <link rel="stylesheet" href="css/style.css">
        <script src="js/jquery-1.7.1.min.js"></script>
        <script src="js/script.js"></script>
    </head>

    <body>

        <!-- PRO Framework Panel Begin -->
        <div id="advanced">
            <span class="trigger">
                <strong></strong>
                <em></em>
            </span>
            <div class="bg_pro">
                <div class="pro_main">
                    <a href="" class="pro_logo"></a>
                    <ul class="pro_menu">
                        <li>
                            <a href="index.jsp">
                                <img src="images/pro_home.png" alt="">
                            </a>
                        </li>

                        <c:if test="${isLoggedIn == 'true'}">
                            <li style="margin-left: 300px">
                                <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=displayCart">Mon Panier</a>
                            </li>
                            <li>
                                <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=afficherMonCompte">Mon Compte</a>
                            </li>
                            <li>
                                <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=logout">Déconnexion</a>
                            </li>
                        </c:if>
                        <c:if test="${isLoggedIn != 'true'}">
                            <li style="margin-left: 300px">
                                <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=displayCart">Mon Panier</a>
                            </li>
                            <li>
                                <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=gotoSubscribe">Inscription</a>
                            </li>
                            <li><a>Se connecter<span></span></a>  
                                <ul>
                                    <form action="/AdopteUnPrestaWA/ServletChargementDonnees?action=login" method="POST">
                                        <div>
                                            <label for="login">Identifiant : </label> <br/>
                                            <input name="login" type="text" size="10" maxlength="255" style="height:15px;font-size:14px;width: 130px"/> <br/><br/>                          
                                        </div>
                                        <div>
                                            <label for="password"> Mot de passe : </label> <br/>
                                            <input name="password" type="password" size="10" maxlength="255" style="height:15px;font-size:14px;width: 130px"/> <br/><br/>
                                        </div>
                                        <input class="btn sign-in" type="submit" value="Connexion" />
                                    </form>
                                </ul>
                            </li>
                        </c:if>
                    </ul>          
                </div>       
            </div>   
        </div>

        <!-- PRO Framework Panel End -->
        <div class="bg-main">

            <!--==============================header=================================-->

            <header>
                <div class="container_24">
                    <div class="wrapper">
                        <div class="grid_13">
                            <h1><a href="index.jsp">Idealex</a></h1>
                        </div>
                        <div class="grid_11">
                            <form action="/AdopteUnPrestaWA/ServletChargementDonnees?action=rechercher" method="POST">
                                <div align="right">
                                    <input style=" font:11px/15px Arial, Helvetica, sans-serif; " type="text" name="search_query">
                                    <input style=" background:#1f2025; font:11px/15px Arial, Helvetica, sans-serif; text-transform:uppercase; color:#eaeaea; padding:8px 8px 8px 8px;" type="submit" value="Rechercher">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <nav class="main-menu">
                    <ul class="sf-menu">
                        <li><a href="more.jsp"><em>A propos</em><strong></strong></a><ul>
                                <li><a href="more.jsp">Qui sommes-nous ?</a></li>
                                <li><a href="enConstruction.jsp">Nouvelles</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=product">Produits</a></li>
                            </ul>
                        </li>
                        <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=product"><em>Produits</em><strong></strong></a><ul>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=product">Tous</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=developer">Développeurs</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=projectManager">Chefs de projet</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=productManager">Responsables produits</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=architect">Architectes</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=coach">Coach / Scrum Master</a></li>
                                <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=consultant">Consultants</a></li>
                            </ul>
                        </li>	
                        <li><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=productStores"><em>Partenaires</em><strong></strong></a></li>
                        <li><a href="enConstruction.jsp"><em>Autres</em><strong></strong></a></li>
                        <li><a href="enConstruction.jsp"><em>Clients</em><strong></strong></a></li>
                        <c:set var="etatUtilisateur" scope="session" property="account.accessLevel" />

                        <c:if test="${account.accessLevel == 2}">
                            <!-- c:out value="Bienvenue super-admin" /> -->
                            <li><a href="super-admin.jsp"><em>Administration</em><strong></strong></a><ul>
                                    <li>Compte</li>
                                    <li><a href="ajoutAccount.jsp">Créer Compte</a></li>
                                    <li><a href="modifAccount.jsp">Modifier/Supprimer</a></li>
                                    <li>ProductStore</li>
                                    <li><a href="ajoutProductStore.jsp">Créer ProductStore</a></li>
                                    <li><a href="modifProductStore.jsp">Modifier/Supprimer</a></li>
                                    <li>Prestataires</li>
                                    <li><a href="ajoutPresta.jsp">Créer Presta</a></li>
                                    <li><a href="modifPresta.jsp">Modifier/Supprimer</a></li>     
                                    <li>Autres</li>	
                                </ul>
                            </li>
                        </c:if>
                        <c:if test="${account.accessLevel == 1}">
                            <!-- c:out value="Bienvenue admin" /> -->                                        
                            <li><a href="admin.jsp"><em>Options</em><strong></strong></a><ul>
                                    <li><a href="ajoutPresta.jsp">Créer Presta</a></li>
                                    <li>Autres</li>						
                                </ul>				
                            </li>	


                        </c:if>
                        <c:if test="${account.accessLevel == 0}">
                            <!-- c:out value="Bienvenue utilisateur" /> -->
                            <li></li>
                        </c:if>
                        <li class="last"><a href="contacts.jsp"><em>Contacts</em><strong></strong></a></li>
                    </ul>
                    <div class="clear"></div>
                </nav>

            </header>

            <!--==============================section=================================-->
            <section class="padsection7">
                <div class="container_24">
                    <div class="wrapper">
                        <div class="grid_24">
                            <c:set var="monPresta" scope="session" value ="${sessionScope['p_presta']}"/>
                            <c:set var="cvMonPresta" scope="session" value ="${sessionScope['cvOfPresta']}"/>
                            <h1 class="title3">Fiche du prestataire - <c:out value="${monPresta.prenom}"/> <c:out value="${monPresta.nom}"/> </h1>

                            <div class="wrapper">
                                <div class="image_left">
                                    <%
                                        listephotos = (List<Photo>) request.getAttribute("listephotos");
                                        p_first_path = new String("images/stock_images/900x500_2.jpg");
                                        if ((presta != null) && (listephotos != null)) {
                                            Iterator<Photo> itphoto = listephotos.iterator();
                                            while (itphoto.hasNext()) {
                                                Photo p_first = itphoto.next();
                                                if (p_first.getProductidProduct() == presta.getIdProduct()) {
                                                    p_first_path = p_first.getCheminPhoto();
                                                }
                                            }
                                            request.getSession().setAttribute("p_first_path", p_first_path);
                                        }
                                    %>
                                    <a href='${p_first_path}' data-gal="prettyPhoto[gallery8]" class="image_style3 image_with_capt lightbox-image">
                                        <img height="340" width="300" src='${p_first_path}' alt='Photo presta'>
                                    </a>

                                </div>
                                <p>Nom : <c:out value="${monPresta.nom}"/> </p>
                                <p>Prénom : <c:out value="${monPresta.prenom}"/> </p>  
                                <p>Prix : <b><c:out value="${monPresta.prix}"/></b></p>  
                                <p>Etat : <b><c:out value="${sessionScope['p_etat_full']}"/></b></p> 
                                <p>Description : <c:out value="${monPresta.description}"/></p>
                               
                                <c:if test="${monPresta.etat == '1'}">
                                    <div class=" alignright"><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=ajouterPrestaPanier&selected_presta=${monPresta.idProduct}" class='btn'>Ajouter au panier</a></div>
                                </c:if>

                            </div>

                            <hr>
                            <h1 class="title3">Informations complémentaires sur ce prestataire </h1>
                            <p>Situation Matrimoniale : <c:out value="${cvMonPresta.situationMatrimoniale}"/></p>
                            <p>Formation : <c:out value="${cvMonPresta.formation}"/></p>
                            <p>Competences : <c:out value="${cvMonPresta.competences}"/></p>       
                            <p>Experience Professionnelle : <c:out value="${cvMonPresta.experienceProfessionnelle}"/></p>
                            <p>Loisirs : <c:out value="${cvMonPresta.loisirs}"/></p>

                            <hr>
                            <h1 class="title3">Commentaires sur <c:out value="${monPresta.prenom}"/> <c:out value="${monPresta.nom}"/> </h1>
                            <!-- Insérer la gestion des commentaires ici -->
                            <c:set scope="request" var="commentairesDuPresta" value="${listeCommentaires}"/>
                            <c:if test="${noComment == 'true'}">
                                <c:out value="Aucun commentaire sur ce prestataire." />
                            </c:if>
                            <c:forEach var="item"  items="${requestScope['commentairesDuPresta']}" >   
                                <blockquote class="quotes_3">
                                    <c:out value="${item.commentaire}" />
                                    <img src="images/quote-br.gif" alt="">
                                </blockquote>
                                <c:out value="Note : ${item.note}/5" />
                                <div class="lineH"></div>
                            </c:forEach>
                            <div><a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=ajouterCommentaire&idPresta=${monPresta.idProduct}" class='btn'>Ajouter un commentaire</a></div>
                            <hr>
                            <h1 class="title3">Voir toutes les photos de <c:out value="${monPresta.prenom}"/> <c:out value="${monPresta.nom}"/> </h1>
                            <c:forEach var="photoitem" items="${requestScope['listephotos']}"> 
                                <c:if test="${photoitem.productidProduct == monPresta.idProduct}">
                                    <a href='${photoitem.cheminPhoto}' data-gal="prettyPhoto[gallery10]" class="image_style3 image_with_capt lightbox-image">
                                        <img height="170" width="150" src='${photoitem.cheminPhoto}' alt="">
                                    </a>      
                                </c:if>
                            </c:forEach>

                            <!-- Insérer ici le code de l'affichage des suggestions, si on décide de le mettre -->
                            <hr>
                            <h3 class="title3">Retrouvez nos meilleures offres sur le même thème :</h3>
                            <section class="padsection7">

                                <div class="car-wrapper">
                                    <div class="carousel">
                                        <ul>
                                            <c:forEach var="oth_prod_item" items="${requestScope['listeotherprod']}"> 
                                                <li>
                                                    <c:set var="oth_p_item" value="${oth_prod_item}" scope="request" />
                                                    <%
                                                        oth_p_tmp = (Product) request.getAttribute("oth_p_item");
                                                        listephotos = (List<Photo>) request.getAttribute("listephotos");
                                                        if ((oth_p_tmp != null) && (listephotos != null)) {
                                                            Iterator<Photo> itphoto = listephotos.iterator();
                                                            while (itphoto.hasNext()) {
                                                                Photo p_first = itphoto.next();
                                                                if (p_first.getProductidProduct() == oth_p_tmp.getIdProduct()) {
                                                                    p_first_path = p_first.getCheminPhoto();
                                                                }
                                                            }
                                                            request.getSession().setAttribute("p_first_path", p_first_path);
                                                        }
                                                    %>
                                                    <div class="view view_first">
                                                        <img height="170" width="150" src='${p_first_path}' alt="" class="image_style3">
                                                        <div class="mask">

                                                            <p><c:out value="${oth_prod_item.prenom}"/> <c:out value="${oth_prod_item.nom}"/></p>
                                                            <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=afficherPresta&selected_presta=${oth_prod_item.idProduct}" class="btn">Voir fiche</a>
                                                        </div>
                                                    </div>
                                                </li>
                                            </c:forEach>
                                        </ul>
                                    </div>
                                    <a href="#" class="btn prev" data-type="prevPage"><span></span></a> <!-- Previous Page Button -->
                                    <a href="#" class="btn next" data-type="nextPage"><span></span></a> <!-- Next Page Button -->
                                </div> <!-- Fin de la liste des prestas à consulter si on a aimé... -->
                            </section>

                        </div>
                    </div>
                </div>
            </section>
        </div>


        <!--==============================footer=================================-->
        <footer>
            <div class=" container_24">
                <div class="wrapper">
                    <div class="grid_6 suffix_2">
                        <h1 class="footer-logo"><a href="index.jsp">idealex</a></h1>
                        <p>Adopte Un Presta</p>
                        <p class="color1 privacy">&copy; 2013 <span>|</span>  <a href="/AdopteUnPrestaWA/ServletChargementDonnees?action=politiqueConf">Politique de confidentialité</a> <!-- {%FOOTER_LINK} --></p>
                    </div>
                    <div class="grid_7 suffix_2">
                        <h4>Liens connexes</h4>
                        <div class="wrapper">
                            <div class="grid_4 alpha">
                                <ul class="footer-list">
                                    <li><a href="more.jsp">A propos de nous</a></li>
                                    <li><a href="more.jsp">Notre concept</a></li>
                                    <li><a href="more.jsp">Nos partenaires</a></li>
                                    <li><a href="more.jsp">Evénements &amp; Press</a></li>
                                    <li><a href="more.jsp">Nous contacter</a></li>
                                </ul>
                            </div>
                            <div class="grid_3 omega">
                                <ul class="footer-list">
                                    <li><a href="more.jsp">Se connecter</a></li>
                                    <li><a href="more.jsp">Forums</a></li>
                                    <li><a href="more.jsp">Programme de fidélité</a></li>
                                    <li><a href="more.jsp">FAQ</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="grid_7">
                        <h4>Nous suivre</h4>
                        <ul class="tooltips">
                            <li><a href="more.jsp"><img src="images/icon1.png" alt=""><span>RSS</span></a></li>
                            <li><a href="more.jsp"><img src="images/icon3.png" alt=""><span>Facebook</span></a></li>
                            <li><a href="more.jsp"><img src="images/icon2.png" alt=""><span>Twitter</span></a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </footer>
    </body>
</html>

